import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractInfoVO, ContractInfoForm, ContractInfoQuery } from '@/api/nursing/contractInfo/types';

/**
 * 查询合同信息列表
 * @param query
 * @returns {*}
 */

export const listContractInfo = (query?: ContractInfoQuery): AxiosPromise<ContractInfoVO[]> => {
  return request({
    url: '/nursing/contractInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同信息详细
 * @param contractId
 */
export const getContractInfo = (contractId: string | number): AxiosPromise<ContractInfoVO> => {
  return request({
    url: '/nursing/contractInfo/' + contractId,
    method: 'get'
  });
};

/**
 * 新增合同信息
 * @param data
 */
export const addContractInfo = (data: ContractInfoForm) => {
  return request({
    url: '/nursing/contractInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同信息
 * @param data
 */
export const updateContractInfo = (data: ContractInfoForm) => {
  return request({
    url: '/nursing/contractInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同信息
 * @param contractId
 */
export const delContractInfo = (contractId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/contractInfo/' + contractId,
    method: 'delete'
  });
};
